Toki Tori GBC ~ rem

Level file

// massive thanks to @MstrBlinky for help with this.

struct rem_entity_t {
    char x;
    char y;
    char type;  // bottom 3 bits are type, middle 2 bits are direction, top 3 bits are extra data
                // types: 0 = egg,
                //        1 = toki
                //        3 = monster
                //        4 = passive
                //        5 = special
};

struct rem_tool_t {
    char type;
    char count; // 0xFF for infinite.
};

struct rem_file_t {
    char world_theme; // 0 = Forest Falls, 1 = Creepy Castle, 2 = Slime Cave, 3 = Bubble Barrage
    char layout;      // 0 = 32x128, 1 = 64x64, 2 = 128x32
    char width;
    char height;
    char title_length;
    char title[title_length];
    char designer_length;
    char designer[designer_length];
    char comment_length;
    char comment[comment_length];
    char entities_count;
    rem_entity_t entities[entities_count];
    char tools_count;
    rem_tool_t tools[tools_count];
    short duration;
    bool attr_stairs[width * height]; // not width*height bytes in file, it's compressed
    bool attr_solid[width * height];
    bool attr_front[width * height];
    char tiles[width * height];       // compressed, different algorithm than for attributes
};